﻿// See https://aka.ms/new-console-template for more information
using DbFactory;
using Microsoft.EntityFrameworkCore;

using (DbContext dbContext = DbContextProvider.GetContext())
{
    var database = dbContext.Database;
    database.EnsureDeleted();
    database.EnsureCreated();

    try
    {
        database.BeginTransaction();
        UserFactory.Create();
        PhoneFactory.Create();
        CareerFactory.Create();
        dbContext.SaveChanges();
        database.CommitTransaction();
    }
    catch (Exception)
    {
        database.RollbackTransaction();
        throw;
    }
}

